package org.example.ruoxing_admin_springboot3.service.Oss;

import org.example.ruoxing_admin_springboot3.httpResponseResult.ResponseResult;
import org.example.ruoxing_admin_springboot3.utils.MinioUtil;
import org.example.ruoxing_admin_springboot3.viewmodel.FileUploadResult;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

@Service
public class MinioService {
    /**
     * @description 单文件上传的方法
     * @author 莫若省
     * @createTime 2024/6/12
     */
    public ResponseResult<Object> uploadFile(MultipartFile file) {
        try {
            FileUploadResult fileUploadResult = MinioUtil.uploadFile(file);
            return ResponseResult.SUCCESS(fileUploadResult);
        } catch (Exception e) {
            return ResponseResult.ERROR();
        }
    }
}
